****TABLE A1****

cd "$main_dir/output/tables/appendix_a"

//--------------------------------------------------------
//Read in relevant datasets
//--------------------------------------------------------

clear
use "$data_dir/clean/harmonized_dataset.dta"

gen dummy = 1
bys survey: egen total_obs = total(dummy)

tab sex if sex!=-99, gen(sex_dummy)
tab religion if religion!=-99, gen(religion_dummy)
tab edu if edu!=-99, gen(edu_dummy)
tab marital if marital!=-99, gen(marital_dummy)

cap drop male
rename sex_dummy1 male
rename sex_dummy2 female

rename religion_dummy1 no_religion
rename religion_dummy2 buddhist
rename religion_dummy3 jewish
rename religion_dummy4 christian
rename religion_dummy5 muslim
rename religion_dummy7 hindu

cap drop tertiary
rename edu_dummy1 primary
rename edu_dummy2 secondary
rename edu_dummy3 tertiary
rename edu_dummy4 none

rename marital_dummy1 married
rename marital_dummy2 not_married

//--------------------------------------------------------
//Create Table A1
//--------------------------------------------------------

collapse total_obs trust_govt trust_others trust_state male female no_religion buddhist jewish christian muslim hindu primary secondary tertiary none married not_married, by(survey)

local varlist trust_govt trust_others trust_state male female no_religion buddhist jewish christian muslim hindu primary secondary tertiary none married not_married
foreach var of local varlist {
	format `var' %5.0g
}

export delimited using "table_a1.csv", replace

